package com.headwind.logistics.prople.service.impl;

import com.headwind.logistics.common.pojo.Customer;
import com.headwind.logistics.prople.mapper.CustomersMapper;
import com.headwind.logistics.prople.service.inter.CustomersServiceInter;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author Gu1028
 * @Date 2020/7/20 10:47
 * @Version 1.0
 * @DESCRIPTION 填写类作用描述
 */
@Service
public class CustomersServiceImpl implements CustomersServiceInter {


    @Resource
    private CustomersMapper customersMapper;


    /**
     * 查询出所有数据并且分页
     * @param page
     * @param rows
     * @return
     */
    @Override
    public List<Customer> selectAllCustomer(Integer page, Integer rows) {
        if (page != null){
            page = (page-1)*rows;
        }
        return customersMapper.selectAllCustomer(page,rows);
    }


    /**
     * 根据员工id修改员工信息
     * @param customer
     * @return
     */
    @Override
    public int updateCustomerByCustId(Customer customer){

        return customersMapper.updateCustomerByCustId(customer);

        }


    /**
     * 根据姓名、性别、手机号 搜索顾客
     * @param customer
     * @return
     */
    @Override
    public List<Customer> queryCustomerByNameOrSexOrPhoneOrStatus(Customer customer, Integer page, Integer rows) {
        if (page != null){
            page = (page-1)*rows;
        }

        return customersMapper.queryCustomerByNameOrSexOrPhoneOrStatus(customer,page,rows);
    }




}
